package cn.tedu.charging.cost.controller;

import cn.tedu.charging.common.param.ChargingProgressParam;
import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.common.vo.ChargingProgressVO;
import cn.tedu.charging.cost.service.CostRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class CostRuleController {
    @Autowired
    private CostRuleService costRuleService;

    @PostMapping("/cost/calculate")
    public JsonResult<ChargingProgressVO> costCalc(
            @RequestBody ChargingProgressParam param){
        log.info("开始计算价格,入参:{}",param);
        ChargingProgressVO vo=costRuleService.costCalc(param);
        log.info("开始计算价格,入参:{},出参:{}",param,vo);
        return JsonResult.ok(vo);
    }
}
